package com.fyp.ptma.dao.repository;

import java.util.List;

import javax.persistence.PersistenceException;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.exception.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.fyp.ptma.dao.repository.irepository.IDefectDao;
import com.fyp.ptma.model.Application;
import com.fyp.ptma.model.ApplicationVersion;
import com.fyp.ptma.model.Defect;

/**
 * 
 * @author YahyaArshad
 * 
 */
@Repository
public class DefectDao implements IDefectDao {
	@Autowired
	private SessionFactory sessionFactory;

	public Session openSession() {
		return sessionFactory.getCurrentSession();
	}

	public Long save(Object objToSave) throws PersistenceException,
			ConstraintViolationException {
		this.openSession().save(objToSave);
		return null;
	}

	public Long update(Object objToUpdate) throws PersistenceException {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean delete(Object objToDelete) throws PersistenceException,
			ConstraintViolationException {
		// TODO Auto-generated method stub
		return false;
	}

	public List<Defect> getDefectsByApplicationVersion(
			ApplicationVersion version) throws HibernateException {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Defect> getDefectsByApplication(Application application)
			throws HibernateException {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Defect> getDownloaderDefects(Application application)
			throws HibernateException {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Defect> getUserDefects(Application application)
			throws HibernateException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveOrUpdate(Object objToSave) throws PersistenceException,
			ConstraintViolationException {
		// TODO Auto-generated method stub
		
	}

}
